Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

Notes/Domino 8 Forum

Notes/Domino 8 Forum

Previous Next
Subject: Function to compare dates
Feedback Type: Problem
Product Area: Designer Client
Technical Area: Application development
Platform: ALL
Release: 8.0.2
Reproducible: Always

Hey!

I need a little help.

There's a function to compare two dates in lotusscript?

Let me explain:

I have two text fields on a web application and I get this dates and make a comparation to run the agent. I know that compare two date- text strings are impossible, so I tried to make it with LSLocalTime.

But I got errors, a lot of them. Could you help me to resolve this pluzze?!

Thanks in advance.

Here is the code:

Use "WorkflowProcedures"
Sub Initialize

MsgBox "Agente MediaDia - Entrou no agente!"

On Error GoTo TrataError

Dim ses As New NotesSession
Dim db As NotesDatabase
Dim vis As NotesView
Dim col As NotesDocumentCollection
Dim doc As NotesDocument
Dim autor As Variant
Dim criacao As Variant
Dim dataHoje As String
Dim total As Long

dataHoje = Format(Now, "mm/dd/yyyy")

MsgBox "Data Hoje: " + CStr(datahoje)

Set Webdoc = ses.DocumentContext
Set db = ses.CurrentDatabase
Set vis = db.GetView("Autores")
Set col = db.Alldocuments
Set doc = col.Getfirstdocument()

'MsgBox "Autor do primeiro documento da colection: " + doc.Authors(0)

total = col.Count

total = 0

While not doc Is nothing

datadoc = doc.Created()

Dim data As New NotesDateTime(dataHoje)

Dim data1 As New NotesDateTime(datadoc)
MsgBox "Data Hoje: " + CStr(dataHoje) + " Data do Doc: " + CStr(datadoc)

If data.LSLocalTime = data1.LSLocalTime Then
'If datadoc = datahoje Then
MsgBox "**************************** Entrou no if *************************"

total = total + 1

End If

MsgBox " Contador: " & total

MsgBox "Data Criação dessa parada: " + CStr(Format(datadoc, "mm/dd/yyyy"))

Set doc = col.Getnextdocument(doc)
Wend



If total = 0 then

Print "<script language=""JavaScript"" type=""text/javascript"">"

'Print |var path = window.location.pathname.substring (0, window.location.pathname.toLowerCase().indexOf(".nsf") + 4);|

Print "alert('Não foram criados documentos de migrações hoje!" ".')";

MessageBox "Não foram criados documentos de migrações hoje!"




Else

Print "<script language=""JavaScript"" type=""text/javascript"">"

'Print |var path = window.location.pathname.substring(0, window.location.pathname.toLowerCase().indexOf(".nsf") + 4);|

Print "alert('Média de Migrações realizada durante o dia: " + CStr(total) + "" + ".')";

MessageBox "Média de Migrações realizada durante o dia: " & CStr(total)



End If

Print "</script>"

Exit sub
TrataError:

MsgBox "Erro: " + Error + Chr(10)+ " na Linha " + CStr(Erl) + Chr(10)+ "numero " + CStr(Err)

End Sub


Feedback number WEBB8UMPLM created by ~Arnold Cisaly on 05/25/2012


Function to compare dates (~Arnold Cisaly 25.May.12)
. . Isolate your code... (~Dan Kikiterobu... 31.May.12)
. . . . It worked! (~Arnold Cisaly 4.Jun.12)




Printer-friendly

Search this forum

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS